package com.studentmanage.manage_course.dao;

import com.studentmanage.framework.domain.base.Course;
import com.studentmanage.framework.domain.base.request.QueryCourse;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CourseMapper {
    String SELECT = "<if test=\"queryCourse.courseName != null and queryCourse.courseName != ''\"> "+
            "where name like \"%\"#{queryCourse.courseName}\"%\" </if> ";
    @Select("<script>select id, name, nature, teachername from course " +
            SELECT +" limit #{queryCourse.page},#{queryCourse.size} </script>")
    public List<Course> findAllLikeName(@Param(value = "queryCourse") QueryCourse queryCourse);
    @Select("<script>select count(*) from course " +
            SELECT + " limit #{queryCourse.page},#{queryCourse.size} </script>")
    public Integer getTotal(@Param(value = "queryCourse") QueryCourse queryCourse);
}
